// 
var AwesomeClass = function() {
	this.prop = "awesome";
	this.func = function(text) {
		console.log(text + " is awesome");
	}
}


// by use middle ware
// we can add some extra property and function
var midware = function(obj) {
	var oldFunc = obj.func;
	obj.func = function(text) {
		console.log('this is func from midware');
		oldFunc(text);
	}
	// now obj.func is revised
}
var midware2 = function(obj) {
	obj.prop2 = "from_midwar2";
	// now obj.prop2 is added
}

var awesomeObj = new AwesomeClass();
midware(awesomeObj);
midware2(awesomeObj);

awesomeObj.func('hello');
console.log(awesomeObj.prop2);
console.log(awesomeObj.prop);

